﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Petra.Gis.DataServices.WKT
{

  ///// <summary>
  ///// WKT Geometry Types
  ///// </summary>
  //public enum WKTGeometryType
  //{
  //  /// <summary>
  //  /// Point.
  //  /// </summary>
  //  Point = 1,

  //  /// <summary>
  //  /// LineString.
  //  /// </summary>
  //  LineString = 2,

  //  /// <summary>
  //  /// Polygon.
  //  /// </summary>
  //  Polygon = 3,

  //  /// <summary>
  //  /// MultiPoint.
  //  /// </summary>
  //  MultiPoint = 4,

  //  /// <summary>
  //  /// MultiLineString.
  //  /// </summary>
  //  MultiLineString = 5,

  //  /// <summary>
  //  /// MultiPolygon.
  //  /// </summary>
  //  MultiPolygon = 6,

  //  /// <summary>
  //  /// GeometryCollection.
  //  /// </summary>
  //  GeometryCollection = 7
  //};



  /// <summary>
  /// WKT Geometry Types
  /// </summary>
  public struct WKTGeometryType
  {

    private string _name;


    private WKTGeometryType(string geomTypeName)
    {
      _name = geomTypeName;
    }




    public override string ToString()
    {
      return _name;
    }



    //// User-defined conversion from WKTGeometryType to string
    //public static implicit operator string(WKTGeometryType t)
    //{
    //  return t.ToString();
    //}



    //  User-defined conversion from string to WKTGeometryType
    public static implicit operator WKTGeometryType(string typeName)
    {
      return new WKTGeometryType(typeName);
    }




    public static bool operator ==(WKTGeometryType left, WKTGeometryType right)
    {
      ////when input is null
      //if (!(left is WKTGeometryType) && !(right is WKTGeometryType))
      //  return true;

      //else if (!(left is WKTGeometryType && right is WKTGeometryType))
      //  return false;

      return left._name == right._name;
    }





    public static bool operator !=(WKTGeometryType left, WKTGeometryType right)
    {
      ////when input is null
      //if (!(left is WKTGeometryType) && !(right is WKTGeometryType))
      //  return false;

      //else if (!(left is WKTGeometryType && right is WKTGeometryType))
      //  return true;

      return left._name != right._name;
    }




    /// <summary>
    /// Point.
    /// </summary>
    public static readonly WKTGeometryType Point = "POINT";

    /// <summary>
    /// LineString.
    /// </summary>
    public static readonly WKTGeometryType LineString = "LINESTRING";

    /// <summary>
    /// Polygon.
    /// </summary>
    public static readonly WKTGeometryType Polygon = "POLYGON";

    /// <summary>
    /// MultiPoint.
    /// </summary>
    public static readonly WKTGeometryType MultiPoint = "MULTIPOINT";

    /// <summary>
    /// MultiLineString.
    /// </summary>
    public static readonly WKTGeometryType MultiLineString = "MULTILINESTRING";

    /// <summary>
    /// MultiPolygon.
    /// </summary>
    public static readonly WKTGeometryType MultiPolygon = "MULTIPOLYGON";

    /// <summary>
    /// GeometryCollection.
    /// </summary>
    public static readonly WKTGeometryType GeometryCollection = "GEOMETRYCOLLECTION";


  }

}
